using System;
using System.Data;
using System.Linq;
using System.ComponentModel;
using System.Reflection;
using System.Collections.Generic;
using VSSAHT.Transfer;
using VSS_AHT.DataAccess;

namespace VSSAHT.DataAccess
{
	public partial class LocationMapper
	{
		#region ToEntity

		public static Location ToEntity(Location entity, LocationDTO businessobject)
		{
			if (businessobject == null)
			{
				return null;
			}
			entity.LocationCode = businessobject.LocationCode;
			entity.LocationID = businessobject.LocationID;
			entity.LocationName = businessobject.LocationName;
            entity.RowVersion = VersionConverter.ToBinary(businessobject.RowVersion);
			return entity;
		}

		#endregion

		#region ToBusinessObject

		public static LocationDTO ToBusinessObject(Location entity)
		{
			if (entity == null)
			{
				return null;
			}
			return new LocationDTO
			{
				LocationCode = entity.LocationCode,
				LocationID = entity.LocationID,
				LocationName = entity.LocationName,
                RowVersion = VersionConverter.ToString(entity.RowVersion)
			};
		}

		#endregion

		#region ToBusinessObjectHasChildren

		public static LocationDTO ToBusinessObjectHasChildren(Location entity, params Type[] types)
		{
			if (entity == null)
			{
				return null;
			}
			LocationDTO businessobject = new LocationDTO
			{
				LocationCode = entity.LocationCode,
				LocationID = entity.LocationID,
				LocationName = entity.LocationName,
                RowVersion = VersionConverter.ToString(entity.RowVersion)
			};
			return businessobject;
		}

		#endregion

	}
}
